// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

#ifndef CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_
#pragma once

#include <string>

#include "include/base/cef_ref_counted.h"
#include "include/internal/cef_types_wrappers.h"
#include "tests/cefclient/browser/osr_renderer.h"

namespace client {

class RootWindowManager;

// Used to store global context in the browser process. The methods of this
// class are thread-safe unless otherwise indicated.
class MainContext {
 public:

	 enum PopupType {
		 poplogin = 0,
		 poptabo = 1,
		 popcomment = 2
	 };
  // Returns the singleton instance of this object.
  static MainContext* Get();

  // Returns the full path to the console log file.
  virtual std::string GetConsoleLogPath() = 0;
  virtual std::string GetDebugLogPath() = 0;

  // Returns the full path to |file_name|.
  virtual std::string GetDownloadPath(const std::string& file_name) = 0;

  // Returns the app working directory including trailing path separator.
  virtual std::string GetAppWorkingDirectory() = 0;

  // Returns the main application URL.
  virtual std::string GetMainURL() = 0;

  // Returns the background color.
  virtual cef_color_t GetBackgroundColor() = 0;

  // Returns true if the Views framework will be used.
  virtual bool UseViews() = 0;

  // Returns true if windowless (off-screen) rendering will be used.
  virtual bool UseWindowlessRendering() = 0;

  // Return the cefrect where windown will show
  virtual CefRect GetBound() = 0;

  virtual void SaveBoundRect(CefRect & r) = 0;

  // Return the caller hwnd
  virtual HWND GetCallerHwnd() = 0;


  // Save root window handler
  virtual void SaveRootHandler(HWND handler) = 0;
   
  virtual void SaveLoginPopupHandler(HWND handler) = 0;

  virtual   HWND GetLoginPopupHandler() = 0;
  // Return root window Handler
  virtual HWND GetRootHandler() = 0;

  // Save login token
  //virtual void SaveLoginToken(std::string t) = 0;

  // Return login token
  //virtual std::string  GetLoginToken() = 0;

  // Save the type identify which app running
  virtual void SaveAppModel(int model) = 0;

  // Return app model
  virtual int GetAppModel() = 0;
  virtual bool IsGalleryApp() = 0; 
  virtual bool IsLoginApp() = 0;
  virtual bool IsCommentApp() = 0;
  virtual bool IsCaptureApp() = 0;
  virtual bool IsWebplayerApp() = 0;
  virtual bool IsAfterSomeApp() = 0;
  virtual bool IsWidgetApp() = 0;
  virtual bool IsNewTabApp() = 0;
  virtual bool IsPaperApp() = 0;
  virtual bool IsUserDetailApp() = 0;
  virtual bool  IsCinemaApp() = 0;
  virtual bool IsUserGuideApp() = 0;
  virtual CefString GetAppName() = 0;
  virtual CefString GetWinClassName() = 0;

  // Return fullscreen enable
  virtual bool IsFullScreen() = 0;

  // Return screen id
  virtual int  GetScreenId() = 0;

  // Return js filepath
  virtual std::string GetJsFilePath() = 0;

  virtual CefString GetJsDirectory() = 0;

  // first url for  aftersome, reload when net disconnect
  virtual CefString GetFirstUrl() = 0;

  virtual std::string GetAnimateUrl() = 0;
  // Save root url
  virtual void SaveURootUrl(std::string url) = 0;

  // Return root url
  virtual std::string GetURootUrl() = 0;

  //Reture  pageidurl
  virtual std::string GetPageidUrl() = 0;

  // Save comment detail url
  virtual void SaveCommentDetailUrl(std::string url) = 0;

  //  Return comment detail url
  virtual std::string GetCommentDetailUrl() = 0;

  // Return attach url
  virtual std::string GetAttachUrl() = 0;

  // Return paper id from url
  virtual CefString GetPidFromUrl() = 0;
  virtual void ClearPidFromUrl() = 0;

  // Return dpi scale
  virtual float  GetDpiScale() = 0;
  virtual void SaveDpiScale(float scale) = 0;

  // Return browser show status
  virtual void SaveShowStatus(bool) =  0;
  virtual bool IsShow() = 0;

  // Return tabindex
  virtual int  GetTabId() = 0;
  virtual void SaveTabId(int id) = 0;

  // Return self's collection  url
  virtual std::string GetCollectionUrl() = 0;

  virtual std::string GetBuckUrl() = 0;

  virtual std::string GetLoginUrl() = 0;

  virtual std::string GetUserUrl() = 0;

  // Return client identify string array, upupoo url config
  virtual std::vector<CefString> &  GetClientIdentify() =  0;

  //  Save and Get popup window type
  virtual void SavePopupType(int type) = 0;
  virtual int GetPopupType() = 0;

  // Save and Get popup  login window's root window
  virtual void SavePopupParentWindow(HWND h) = 0;
  virtual HWND GetPopupParentWindow() = 0;

  // GetPaper detail url  from config file
  virtual CefString GetDetailURL() = 0;

  // Get Paper saved directory
  virtual CefString& GetPaperDirectory() = 0;

  // Get upupoo domain url
  virtual std::string &GetDomainUrl() = 0;

  // Get Index url 
  virtual std::string &GetIndexUrl() = 0;

  virtual CefString GetAnimeDetailFlag() = 0;

  virtual int GetInitVolume() = 0;
  virtual int GetInitPlayModel() = 0;
  virtual int GetInitWebPage() = 0;
  virtual CefString GetInitPlayingId() = 0;
  virtual long GetDownloadSpeed() = 0;
  virtual std::string GetNewMsgNum() = 0;
  virtual std::string GetMsgOpen() = 0;

  //Get user favirate path
  virtual CefString GetFaviratePath() = 0;
  // Populate |settings| based on command-line arguments.
  virtual void PopulateSettings(CefSettings* settings) = 0;
  virtual void PopulateBrowserSettings(CefBrowserSettings* settings) = 0;
  virtual void PopulateOsrSettings(OsrRenderer::Settings* settings) = 0;

  // Returns the object used to create/manage RootWindow instances.
  virtual RootWindowManager* GetRootWindowManager() = 0;

 protected:
  MainContext();
  virtual ~MainContext();

 private:
  DISALLOW_COPY_AND_ASSIGN(MainContext);
};

}  // namespace client

#endif  // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_
